@model StsServerIdentity.Models.DeviceAuthorizationViewModel
@using StsServerIdentity.Resources
@inject LocService SharedLocalizer

<div class="page-header">
    <div class="row page-header">
        <div class="col-sm-10">
            @if (Model.ClientLogoUrl != null)
            {
                <div class="client-logo"><img src="@Model.ClientLogoUrl"></div>
            }
            <h1>
                @Model.ClientName
                <small>@SharedLocalizer.GetLocalizedHtmlString("CONSENT_IS_REQUESTING_YOUR_PERMISSION")</small>
            </h1>
        </div>
    </div>
    @if (Model.ConfirmUserCode)
    {
        <div class="row">
            <div class="col-sm-8">
                <p>
                    @SharedLocalizer.GetLocalizedHtmlString("CONSENT_CONFIRM_AUTH_REQUEST_QUOTES") "@Model.UserCode".
                </p>
            </div>
        </div>
    }
    <div class="row">
        <div class="col-sm-8">
            @await Html.PartialAsync("_ValidationSummary")

            <form asp-action="Callback" class="consent-form">
                <input asp-for="UserCode" type="hidden" value="@Model.UserCode" />

                <div>@SharedLocalizer.GetLocalizedHtmlString("CONSENT_IS_CHECK_UNREQUIRED")</div>

                @if (Model.IdentityScopes.Any())
                {
                    <div class="panel panel-default consent-buttons">
                        <div class="panel-heading consent-title-spacing-bottom">
                            <span class="fas fa-user"></span>
                            @SharedLocalizer.GetLocalizedHtmlString("CONSENT_PERSONAL_INFORMATION")
                        </div>
                        <ul class="list-group">
                            @foreach (var scope in Model.IdentityScopes)
                            {
                                @await Html.PartialAsync("_ScopeListItem", scope)
                            }
                        </ul>
                    </div>
                }

                @if (Model.ApiScopes.Any())
                {
                    <div class="panel panel-default">
                        <div class="panel-heading consent-title-spacing-bottom consent-title-spacing-top">
                            <span class="fas fa-tasks"></span>
                            @SharedLocalizer.GetLocalizedHtmlString("CONSENT_APPLICATION_ACCESS")
                        </div>
                        <ul class="list-group">
                            @foreach (var scope in Model.ApiScopes)
                            {
                                @await Html.PartialAsync("_ScopeListItem", scope)
                            }
                        </ul>
                    </div>
                }

                <div class="form-group">
                    <div class="card">
                        <div class="card-header">
                            <span class="glyphicon glyphicon-tasks"></span>
                            Description
                        </div>
                        <div class="card-body">
                            <input class="form-control" placeholder="Description or name of device" asp-for="Description" autofocus>
                        </div>
                    </div>
                </div>

                <div class="consent-remember">
                    @if (Model.AllowRememberConsent)
                    {
                        <div class="consent-title-spacing consent-title-spacing-top">
                            <label>
                                <input class="consent-scopecheck big_checkbox" asp-for="RememberConsent" />
                                <strong class="consent-middle">@SharedLocalizer.GetLocalizedHtmlString("CONSENT_REMEMBER_MY_DECISION")</strong>
                            </label>
                        </div>
                    }

                    <div class="consent-buttons">
                        <button name="button" value="yes" class="btn btn-primary" autofocus>@SharedLocalizer.GetLocalizedHtmlString("CONSENT_YES_ALLOWED")</button>
                        <button name="button" value="no" class="btn">@SharedLocalizer.GetLocalizedHtmlString("CONSENT_NO_NOT_ALLOWED")</button>
                        @if (Model.ClientUrl != null)
                        {
                            <a class="pull-right btn btn-primary" target="_blank" href="@Model.ClientUrl">
                                <span class="fas fa-info-circle"></span>
                                <strong class="consent-middle">@Model.ClientName</strong>
                            </a>
                        }
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>